package ha.web.database;
import java.util.Random;

public class UserId {
	 
	private String name;
	private String pass;
	private int userId;
	
	/**
	 * 
	 * @return
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * 
	 * @return
	 */
	public String getPass() {
		return pass;
	}
	
	public UserId (String name, String pass) {
//		ValidateUser(name,pass);
		this.name = name;
		this.pass = pass;
		Random r = new Random();
		this.userId =  r.nextInt(Integer.MAX_VALUE);
				//Integer.valueOf(this.name)*Integer.valueOf(this.pass)*r.nextInt();
	}

//	private void ValidateUser(String name, String pass) {
//		return DBConnector.IsUserAtDB(user);		
//	}

	public boolean IsUserAtDB() {
		return DBConnector.IsUserAtDB(this);
	}

	public String GetUserStatistics()
	{
		return DBConnector.GetUserStatistics(this);
	}
	public void AddToUserStatistics(UserId user, boolean won_game)
	{
		DBConnector.UpdateUserStatistics(user, won_game);
	}
	public int getUserID() {
		return userId;
	}
	
	
}
